package com.android.Lmaps;

import java.util.ArrayList;

import android.app.Activity;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.CheckBox;
import android.widget.ImageView;
import android.widget.TextView;

public class AdapterPT extends ArrayAdapter<phongtro> {

	Activity context =null;
	ArrayList<phongtro>myList=null;
	int layoutId;
	
	TextView lblprice, lbladdress;
	ImageView img;
	CheckBox chk;
	
	public AdapterPT(Activity context, int resource, ArrayList<phongtro> objects) {
		super(context, resource, objects);
		// TODO Auto-generated constructor stub
		this.context =context;
		this.myList = objects;
		this.layoutId = resource;
	}


	public View getView(int position,View convertView, ViewGroup parent)
	{
		LayoutInflater inflater = context.getLayoutInflater();
		convertView = inflater.inflate(layoutId, null);
		lblprice = (TextView)convertView.findViewById(R.id.textView_adt_price);
		lbladdress=(TextView)convertView.findViewById(R.id.textView_adt_address);
		chk = (CheckBox)convertView.findViewById(R.id.checkBox_adt_check);
		img =(ImageView)convertView.findViewById(R.id.imageView_adt_icon);
		
		
		if(myList.get(position).getPrice()==0)
		{
			lblprice.setText("agreement");
		}
		else
		{
			lblprice.setText(""+myList.get(position).getPrice());
		}
		lbladdress.setText(""+myList.get(position).getAddress());
		
		return convertView;
	}

}
